import React from 'react';

class Watcher {
  $vm: any;

  $key: any;

  $cb: any;

  constructor(vm, key, cb) {
    this.$vm = vm;
    this.$key = key;
    this.$cb = cb;
    // Dep.target = this;
    // eslint-disable-next-line no-unused-expressions
    this.$vm[this.$key];
    // Dep.target = null;
  }

  update() {
    this.$cb && this.$cb.call(this.$vm, this.$vm[this.$key]);
  }
}
export default Watcher;
